<!-- 商品列表组件 <good-list :list="xx"></good-list> -->
<template>
	<view class="goods-list">
		<view class="list" v-for="(item,index) in list" @click="onSkip(item.id,tab)" :key="index">
			<view class="pictrue">
				<image mode="aspectFill" :src="item.imglogo"></image>
			</view>
			<view class="title-tag">
				<view class="tag">
					<text v-if="item.is_goods === 1">推荐</text>
					{{item.title}}
				</view>
			</view>
			<view class="price-info">
				<view class="user-price">
					<text class="min">￥</text>
					<text class="max">{{item.price}}</text>
				</view>
				<view class="vip-price">
					零售价
					<text>￥{{item.market_price}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			tab:{
				type: Number,
				default(){
					return 0
				}
			},
			list: {
				type: Array,
				default(){
					return []
				}
			}
		},
		methods:{
			/**
			 * 跳转点击
			 * @param {String} id 跳转
			 */
			onSkip(id,tab){
				if(tab==2){
					uni.navigateTo({
						url: '/pages/GoodsDetails/lrGoodsDetails?id='+id
					})
					return false
				}
				uni.navigateTo({
					url: '/pages/GoodsDetails/GoodsDetails?id='+id
				})
				return false
			
			}
		}
	}
</script>

<style lang="scss">
	/* 为你推荐 */
	.goods-list{
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		padding: 0 30rpx;
		.list{
			width: 335rpx;
			// height: 540rpx;
			margin-bottom: 30rpx;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			overflow: hidden;
			.pictrue{
				display: flex;
				justify-content: center;
				width: 100%;
				overflow:hidden;
				image{
					width: 335rpx;
					height: 330rpx;
				}
			}
			.title-tag{
				// display: flex;
				height: 100rpx;
				padding: 20rpx;
				.tag{
					float: left;
					margin-right: 10rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					white-space: normal;
					font-size: 26rpx;
					line-height: 40rpx;
					text{
						font-size: 24rpx;
						color: #FFFFFF;
						padding: 4rpx 16rpx;
						background: #ae87d8;
						border-radius: 6rpx;
						margin-right: 10rpx;
					}
				}
			}
			.price-info{
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				justify-content: space-between;
				padding: 0 20rpx;
				// height: 80rpx;
				margin:10rpx auto;
				.user-price{
					display: flex;
					align-items: center;
					margin-bottom:10rpx;
					text{
						color: $price-clor;
					}
					.min{
						font-size: 24rpx;
					}
					.max{
						font-size: 32rpx;
					}
				}
				.vip-price{
					display: flex;
					align-items: center;
					color: #bbbbbb;
					font-size: 24rpx;
					margin-bottom:10rpx;
					image{
						width: 26rpx;
						height: 26rpx;
						margin-right: 10rpx;
					}
					text{
						color: #bbbbbb;
						font-size: 22rpx;
					}
				}
			}
		}
	}
	.recommend-info{
		width: 100%;
		background-color: #f2f2f2;
		.recommend-title{
			display: flex;
			align-items: center;
			justify-content: center;
			width: 100%;
			// height: 100rpx;
			margin-bottom:30rpx;
			.title{
				display: flex;
				align-items: center;
				image{
					width: 750rpx;
					height: 80rpx;
				}
			}
		}
		
	}
</style>
